import { Controller, Get, Query, Req } from '@nestjs/common';
import { ExCode_Service } from '../exCode/exCode.service';
import { ExCode_ExChange_Dto } from '../exCode/assets/exCode.dto';
import { ApiTags } from '@nestjs/swagger';
import { util_ApiResponse_Base } from '@/common/util/apiResponse';
import { util_Index_ReturnContent } from '@/common/util/index';
import { IRequest } from '@/common/typeScripts';

@Controller('/web/exCodeWeb')
@ApiTags('exCodeWeb 兑换码')
export class ExCodeWeb_Controller {
  constructor(private readonly exCode_Service: ExCode_Service) {}

  @Get('/exchange')
  @util_ApiResponse_Base({
    dataType: 'dataType_string',
    status: 201,
    description: '兑换成功',
    type: '兑换成功',
    summary: '兑换兑换码',
  })
  async exCodeWeb_Exchange(@Query() query: ExCode_ExChange_Dto, @Req() req: IRequest) {
    return util_Index_ReturnContent(await this.exCode_Service.exCode_Web_Exchange(query, req));
  }
}
